<?php $this->_extends('../_layouts/default_layout'); ?>
<?php $this->_block('contents'); ?>
<script type="text/javascript" src="<?=Q::ini('custom_system/base_url')?>js/jq.mselect.js?"></script>
<script type="text/javascript">
$(function(){
var product_categories_data = <?=$product_categories?>;
$(document).mselect(product_categories_data, 'product_categories_id', 'product_categories_id', "<?=isset($_GET['product_categories_id'])?$_GET['product_categories_id']:0?>");
$(".datepicker").datepicker({dateFormat:'yy-mm-dd',changeMonth:true});
});
</script>
<fieldset><legend>查询条件</legend>
<form action="" method="get">
<? include(Q::ini('custom_system/elements_dir') . 'searchform_element.php');?>
<table class="form_table">
	<tr>
		<th>产品编号</th>
		<td>
			<input type="text" name="start_number" value="<?=isset($_GET['start_number']) ? $_GET['start_number'] : ''?>" /> to 
			<input type="text" name="end_number" value="<?=isset($_GET['end_number']) ? $_GET['end_number'] : ''?>" /> 填写后六位，例如：000001
		</td>
	</tr>
	<tr>
		<th>日期</th>
		<td>
			<input type="text" name="begin_create_time" class="datepicker" value="<?=isset($_GET['begin_create_time']) ? $_GET['begin_create_time'] : ''?>" /> to 
			<input type="text" name="end_create_time" class="datepicker" value="<?=isset($_GET['end_create_time']) ? $_GET['end_create_time'] : ''?>" />
		</td>
	</tr>
	<tr>
		<th>操作人</th>
		<td>
	    	<select name="user_id">
			  <option value="">请选择...</option>
			  <? foreach($user as $u):?>
			  <option value="<?=$u['id'];?>" <? if(isset($_GET['user_id']) and ($_GET['user_id']==$u['id'])):?>selected="selected"<? endif;?>><?=$u['name'];?></option>
			  <? endforeach;?>
			</select>
		</td>
	</tr>
	<tr>
		<th>选择分类</th>
		<td><input type="hidden" id="product_categories_id" name="product_categories_id" /></td>
	</tr>
	<tr>
		<td></td>
		<td><input type="submit" id="submit" class="button" value="查询" /></td>
	</tr>
</table>
</form>
</fieldset>
<table width=100% class="list_table">
	<tr>
		<th>日期</th>
		<th>类别名称</th>
		<th>数量</th>
		<?php if(Helper_Plu_Number::$status):?><th>编码前缀</th><?php endif;?>
		<th>开始编码</th>
		<th>结束编码</th>
		<th>操作人</th>
		<th>操作</th>
	</tr>
	<? foreach ($counter as $c):?>
	<tr>
		<td><?=$c['create_time'];?></td>
		<td>
			<? foreach($c['categories_full_info'] as $cc):
				echo $cc['name'] . ' > ';
			endforeach;?>
		</td>
		<td><?=$c['quantity']?></td>
		<?php if(Helper_Plu_Number::$status):?><td><?php echo $c['number_prefix']?></td><?php endif;?>
		<td><?=str_pad($c['start_number'], 6, 0, STR_PAD_LEFT)?></td>
		<td><?=str_pad($c['end_number'], 6, 0, STR_PAD_LEFT)?></td>
		<td><?=$c['create_user_name']?></td>
		<td><a href="<?=url('Product::Warehouse/list', array('start_number' => $c['start_number'], 'end_number' => $c['end_number']))?>">查看</a></td>
	</tr>
	<? endforeach;?>
</table>
<?=$page?>
搜索条件下的总数量：<strong><?=$total_quantity?></strong>
<?php $this->_endblock();?>